﻿
SRC_DIR=./src

CC=g++
AR=ar -cr

OBJS=$(SRC_DIR)/../thpool.o  
TEST_OBJS=$(SRC_DIR)/../thpooltest.o

SRCS=$(SRC_DIR)/thpool.cpp 
TEST_SRCS=$(SRC_DIR)/thpooltest.cpp


TARGET=libthpool.a
TEST_TARGET=thpooltest.exe

LIBS:= 
LDFLAGS:=

DEFINES:=-D_DEBUG

INCLUDE:=

CFLAGS:=-Wall -g $(DEFINES) $(INCLUDE)

CXXFLAGS:=$(CFLAGS) -std=c++11

.PHONY:all

all : $(TARGET) $(TEST_TARGET)
	rm -rf out/
	mkdir out
	cp $(TARGET) $(TEST_TARGET) out/
	
$(TARGET) : $(OBJS)
	$(AR) $@ $?
	
$(OBJS)	: $(SRCS)
	$(CC) $(CXXFLAGS) -c $?

$(TEST_TARGET) : $(TEST_OBJS) $(OBJS)  
	$(CC) -o $@ $? $(LDFLAGS) $(LIBS)

$(TEST_OBJS) : $(TEST_SRCS)
	$(CC) $(CXXFLAGS) -c $?
	
clean:
	rm -rf $(TARGET)
	rm -rf $(OBJS)
	rm -rf $(TEST_TARGET)
	rm -rf $(TEST_OBJS)
